package com.foreknow.oop;

/**
 * 方法的返回值类型以及参数
 * 1.返回值类型可以是类类型
 * 2.参数可以传对象
 */
public class MethodDemo {
    public void method1(Student s){
        System.out.println(s.getName()+"---"+s.getAge());
    }

    public Student method2(){
        Student s1 = new Student();
        s1.setName("abc");
        s1.setAge(20);
        return s1;
    }
    public static void main(String[] args) {
        MethodDemo methodDemo = new MethodDemo();
        Student student = methodDemo.method2();
        System.out.println(student.getName()+"---"+student.getAge());

        Student s1=new Student();
        s1.setName("fender");
        s1.setAge(30);
        methodDemo.method1(s1);
    }
}
